/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="country")
public class Country implements Serializable {
	public Country() {
	}
	
	private int id;
	
	private String name;
	
	private String code;
	
	private Byte type;
	
	private cn.imvc.app.entities.GoodsCountry goodsCountry;
	
	private cn.imvc.app.entities.GoodsCountry goodsCountry1;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_COUNTRY_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_COUNTRY_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	public void setName(String value) {
		this.name = value;
	}
	
	@Column(name="name", nullable=true, length=30)	
	public String getName() {
		return name;
	}
	
	public void setCode(String value) {
		this.code = value;
	}
	
	@Column(name="code", nullable=true, length=10)	
	public String getCode() {
		return code;
	}
	
	/**
	 * 0：国检，1：海关
	 */
	public void setType(byte value) {
		setType(new Byte(value));
	}
	
	/**
	 * 0：国检，1：海关
	 */
	public void setType(Byte value) {
		this.type = value;
	}
	
	/**
	 * 0：国检，1：海关
	 */
	@Column(name="type", nullable=true)	
	public Byte getType() {
		return type;
	}
	
	public void setGoodsCountry(cn.imvc.app.entities.GoodsCountry value) {
		this.goodsCountry = value;
	}
	
	@OneToOne(mappedBy="countryId_g", targetEntity=cn.imvc.app.entities.GoodsCountry.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.GoodsCountry getGoodsCountry() {
		return goodsCountry;
	}
	
	public void setGoodsCountry1(cn.imvc.app.entities.GoodsCountry value) {
		this.goodsCountry1 = value;
	}
	
	@OneToOne(mappedBy="countryId_h", targetEntity=cn.imvc.app.entities.GoodsCountry.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.GoodsCountry getGoodsCountry1() {
		return goodsCountry1;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Country[ ");
			sb.append("Id=").append(getId()).append(" ");
			sb.append("Name=").append(getName()).append(" ");
			sb.append("Code=").append(getCode()).append(" ");
			sb.append("Type=").append(getType()).append(" ");
			if (getGoodsCountry() != null)
				sb.append("GoodsCountry.Persist_ID=").append(getGoodsCountry().toString(true)).append(" ");
			else
				sb.append("GoodsCountry=null ");
			if (getGoodsCountry1() != null)
				sb.append("GoodsCountry1.Persist_ID=").append(getGoodsCountry1().toString(true)).append(" ");
			else
				sb.append("GoodsCountry1=null ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
